<!DOCTYPE html>
<html lang="en"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="../static/css/user/reset.css">
    <link rel="stylesheet" href="../static/css/user/commone.css">
    <link rel="stylesheet" media="screen and (min-width:481px)" href="../static/css/user/usercenter_002.css">
    <link rel="stylesheet" media="screen and (max-width:480px)" href="../static/css/user/usercenter.css">

    <script src="../../static/js/hm.js"></script>
    <script type="text/javascript">
    var basePath ="/";
</script>
    <script src="../static/js/jquery-3.js"></script>

    <script src="../../static/layui/lay/modules/layer.js"></script>
    <link rel="stylesheet" href="../../static/layui/css/modules/layer/default/layer.css" id="layuicss-layer">
    <title>个人中心</title>

</head>
<body>
<div class="content">

    <div class="content-top">
        <div class="content-top-info">
            <div class="content-top-left">
                <div class="left-logo">
                    <a href="https://www.hasbei.com/" class="logo-info" target="_self"><img src="../static/image/logo.png" alt="有贝口腔网"></a>
                </div>
                <ul class="right-list">
                    <li><a href="https://www.hasbei.com/zx" target="_self"><img src="../static/image/news-icon.png" alt="有贝口腔网"><span>资讯</span></a></li>
                    <li><a href="https://www.hasbei.com/qa" target="_self"><img src="../static/image/qa-icon.png" alt="有贝口腔网"><span>问答</span></a></li>
                </ul>
            </div>
            <form action="/search" method="get">
                <div class="content-top-right">
                    <div class="search-input">
                        <img class="search-icon" src="../static/image/icon_Search.png">
                        <input class="top-search" type="text" name="kw" placeholder="请输入资讯、问题搜索">
                        <input class="search-sub" type="submit" value="搜索">
                    </div>


                    <div class="land-success">
                        <script type="text/javascript">
                            $(function(){
                                getUserReadCount();
                            })
                            function getUserReadCount(){

                                $.post(basePath+"user/center/getNoReadCount",function(data){
                                    var msgCount=0;
                                    var html="<a href=\"/user/center/msgindex\">#type<span class=\"tips-num\">#count</span></a>";
                                    var setHtml="";
                                    $("#myNoticeModul").html(setHtml);
                                    var list=data.data;
                                    var size=list.length;
                                    for(var i=0;i<size;i++){
                                        var type=list[i].type;
                                        var count=list[i].count;
                                        msgCount=msgCount+count;
                                        if(type==10){
                                            setHtml=html.replace("#type","文章审核").replace("#count",count);
                                        }else if(type==20){
                                            setHtml=html.replace("#type","提问审核").replace("#count",count);
                                        }else if(type==21){
                                            setHtml=html.replace("#type","回答审核").replace("#count",count);
                                        }
                                        $("#myNoticeModul").append(setHtml);
                                    }
                                    if(msgCount==0){
                                        setHtml=html.replace("#type","站内消息").replace("#count",msgCount);
                                        $("#myNoticeModul").append(setHtml);
                                    }
                                    $("#msgCount").html(msgCount);
                                    if(msgCount>0){
                                        $(".notice-tip").show();
                                    }else{
                                        $(".notice-tip").hide();
                                    }
                                });
                                /* setTimeout(function(){
                                    getUserReadCount();
                             },3000); */
                            }
                        </script>
                        <div class="message-notice">
                            <a href="https://www.hasbei.com/user/center/msgindex"><img src="../static/image/notice.png" alt="有贝口腔网"><span class="notice-tip" id="msgCount" style="display:none">0</span></a>
                            <div class="notice-modul" id="myNoticeModul"><a href="https://www.hasbei.com/user/center/msgindex">站内消息<span class="tips-num">0</span></a></div>
                        </div>
                        <div class="land-success-img">
                            <a href="https://www.hasbei.com/user/center/index">
                                <img src="../static/image/69cb5aa91de047839ae0fad1c8897c77.png">
                                <span class="land-success-name">伍杰真他妈帅</span>
                            </a>
                            <div class="img-posi-div">
                                <a href="https://www.hasbei.com/user/center/getUserInfo"><span>个人信息</span></a>
                                <a href="javascript:;" onclick="loginOut()"><span>退出登录</span></a>
                            </div>
                        </div>

                    </div>
                </div>
            </form>
        </div>
    </div>


    <div class="content-main">
        <div class="main-info">
            <div class="main-user-left">

                <div class="user-left-card info-card">
                    <div class="user-img"><img src="../static/image/69cb5aa91de047839ae0fad1c8897c77.png"></div>
                    <div class="usertop-for-phone">
                        <div class="user-name">伍杰真他妈帅</div>
                        <div class="user-style">伍杰帅的一笔</div>
                        <div class="user-editor">
                            <a href="https://www.hasbei.com/user/1316380099620245504" target="_blank">
                                <span>个人主页</span>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="user-left-card">
                    <div class="card-flex">
                        <div class="user-inter"><a href="javascript:"><span class="user-inter-num">0</span><span>提问</span></a></div>
                        <div class="line"></div>
                        <div class="user-inter"><a href="javascript:"><span class="user-inter-num">0</span><span>回答</span></a></div>
                        <div class="line"></div>
                        <div class="user-inter"><a href="javascript:"><span class="user-inter-num">0</span><span>文章</span></a></div>
                    </div>
                </div>
                <div class="user-left-card">
                    <div class="user-editor user-editor-active">
                        <a href="https://www.hasbei.com/user/center/index">
                            <img class="tip-img" src="../static/image/usercenter.png" alt="有贝口腔网">
                            <span>个人中心</span>
                            <img class="bottom-right" src="../static/image/arrow-bttom.png" alt="有贝口腔网">
                        </a>
                    </div>
                    <div class="user-editor">
                        <a href="https://www.hasbei.com/user/center/getUserInfo">
                            <img src="../static/image/Write.png" alt="有贝口腔网">
                            <span>个人信息</span>
                            <img class="bottom-right" src="../static/image/arrow-bttom.png" alt="有贝口腔网">
                        </a>
                    </div>
                    <div class="user-editor">
                        <a href="https://www.hasbei.com/user/center/msgindex">
                            <img src="../static/image/notice-lan.png" alt="有贝口腔网">
                            <span>站内消息</span>
                            <img class="bottom-right" src="../static/image/arrow-bttom.png" alt="有贝口腔网">
                        </a>
                    </div>
                </div>

            </div>

            <div class="main-user-right">
                <div class="user-right-top">
                    <ul>
                        <li class="select-active" id="dy"><a href="javascript:;">动态</a></li>
                        <li id="q"><a href="javascript:;">提问&nbsp;0</a></li>
                        <li id="an"><a href="javascript:;">回答&nbsp;1</a></li>
                        <li id="art"><a href="javascript:;">文章&nbsp;0</a></li>
                        <li id="col"><a href="javascript:;">收藏&nbsp;1</a></li>
                    </ul>
                </div>
                <div class="user-right-action">
                    <div id="myContent"></div>
                    <div class="more-content">
                        <div class="load-more" style="display: none;">
                            <img src="../static/image/load-more.gif">
                            <span>加载中</span>
                        </div>
                        <div class="load-more-two load-more-fade" style="display:none" onclick="moreList()">点击加载更多</div>
                        <div class="no-data" style="">┭┮﹏┭┮,没有数据啦</div>
                    </div>
                </div>

            </div>
        </div>
    </div>

    <!--底部-->
    <th:block th:include="comment/button::button"/>

</div>
<script>
    function delDy(obj){//删除动态
        var id=$(obj).attr("id");
        layer.confirm('你确定要删除吗,删除后不可恢复哦？', {btn: ['确定','取消']},
            function(){
                $.post(basePath+"user/center/dy/del?id="+id,function(data){
                    if(data.success){
                        layer.msg("删除成功");
                        $("#item"+id).remove();
                    }else{
                        layer.msg(data.msg);
                    }
                });
            }
            ,function(){});
    }
    function delQa(obj){ //删除问题
        var id=$(obj).attr("id");
        layer.confirm('你确定要删除吗,删除后不可恢复哦？', {btn: ['确定','取消']},
            function(){
                $.post(basePath+"user/center/qa/del?no="+id,function(data){
                    if(data.success){
                        layer.msg("删除成功");
                        $("#item"+id).remove();
                    }else{
                        layer.msg(data.msg);
                    }
                });
            }
            ,function(){});
    }
    function delQaReply(obj){ //删除回答
        var id=$(obj).attr("id");
        layer.confirm('你确定要删除吗,删除后不可恢复哦？', {btn: ['确定','取消']},
            function(){
                $.post(basePath+"user/center/qaReply/del?id="+id,function(data){
                    if(data.success){
                        layer.msg("删除成功");
                        $("#item"+id).remove();
                    }else{
                        layer.msg(data.msg);
                    }
                });
            }
            ,function(){});
    }
    function editQaReply(obj){ //编辑回答
        var id=$(obj).attr("id");
        layer.open({
            type: 2,
            title: "编辑回答",
            shadeClose: false,
            area: ['900px', '600px'],
            fixed: true,
            maxmin: false,
            scrollbar: false,
            content:basePath+'user/center/qaReply/edit/'+id
        });
    }
    function delCollect(obj){ //删除回答
        var id=$(obj).attr("id");
        layer.confirm('你确定要删除吗,删除后不可恢复哦？', {btn: ['确定','取消']},
            function(){
                $.post(basePath+"user/collect/del?id="+id,function(data){
                    if(data.success){
                        layer.msg("删除成功");
                        $("#item"+id).remove();
                    }else{
                        layer.msg(data.msg);
                    }
                });
            }
            ,function(){});
    }
    function delArt(obj){ //删除文章
        var id=$(obj).attr("id");
        layer.confirm('你确定要删除吗,删除后不可恢复哦？', {btn: ['确定','取消']},
            function(){
                $.post(basePath+"user/center/article/del?no="+id,function(data){
                    if(data.success){
                        layer.msg("删除成功");
                        $("#item"+id).remove();
                    }else{
                        layer.msg(data.msg);
                    }
                });
            }
            ,function(){});
    }
    function editArt(obj){ //删除文章
        var id=$(obj).attr("id");
        layer.open({
            type: 2,
            title: "编辑文章",
            shadeClose: false,
            area: ['900px', '600px'],
            fixed: true,
            maxmin: false,
            scrollbar: false,
            content:basePath+'user/center/article/edit/'+id
        });
    }


    var current=1;
    var tabId="";
    //动态数据
    function dyList(){
        $(".load-more").show();
        $(".load-more-two").hide();
        $.post(basePath+"user/center/dy/list?current="+current,function(data){
            $(".load-more").hide();
            //如果没有数据了就隐藏
            if(data.length==0){
                $(".load-more-two").hide();
                if(current==1){
                    $(".no-data").show();
                }
            }else{
                $(".load-more-two").show();
                $("#myContent").append(data);
            }
        });
    }
    //提问数据
    function qaList(){
        $(".load-more").show();
        $(".load-more-two").hide();
        $.post(basePath+"user/center/qalist?current="+current,function(data){
            $(".load-more").hide();
            //如果没有数据了就隐藏
            if(data.length==0){
                $(".load-more-two").hide();
                if(current==1){
                    $(".no-data").show();
                }
            }else{
                $(".load-more-two").show();
                $("#myContent").append(data);
            }
        });
    }
    //回答数据列表
    function qaReplyList(){
        $(".load-more").show();
        $(".load-more-two").hide();
        $.post(basePath+"user/center/qaReplylist?current="+current,function(data){
            $(".load-more").hide();
            //如果没有数据了就隐藏
            if(data.length==0){
                $(".load-more-two").hide();
                if(current==1){
                    $(".no-data").show();
                }
            }else{
                $(".load-more-two").show();
                $("#myContent").append(data);
            }
        });
    }
    //收藏数据列表
    function collectList(){
        $(".load-more").show();
        $(".load-more-two").hide();
        $.post(basePath+"user/center/collectList?current="+current,function(data){
            $(".load-more").hide();
            //如果没有数据了就隐藏
            if(data.length==0){
                $(".load-more-two").hide();
                if(current==1){
                    $(".no-data").show();
                }
            }else{
                $(".load-more-two").show();
                $("#myContent").append(data);
            }
        });
    }
    //收藏数据列表
    function articleList(){
        $(".load-more").show();
        $(".load-more-two").hide();
        $.post(basePath+"user/center/articlelist?current="+current,function(data){
            $(".load-more").hide();
            //如果没有数据了就隐藏
            if(data.length==0){
                $(".load-more-two").hide();
                if(current==1){
                    $(".no-data").show();
                }
            }else{
                $(".load-more-two").show();
                $("#myContent").append(data);
            }
        });
    }
    function loadTabList(){
        if(tabId=='dy'){//动态
            dyList();
        }else if(tabId=='an'){// 回答
            qaReplyList();
        }else if(tabId=='q'){// 提问
            qaList();
        }else if(tabId=='col'){// 收藏
            collectList();
        }else if(tabId=='art'){// 文章
            articleList();
        }
    }
    //加载更多
    function moreList(){
        current++;
        loadTabList();
    }
    function initList(){
        tabId='dy';//动态
        dyList();
    }
    initList();//初始化

    //重新加载从第一页开始
    function initListPage1(){
        current=1;
        $("#myContent").html("");
        $(".load-more-two").hide();
        $(".no-data").hide();
        loadTabList();
    }

    $(function(){
        initPageEvFun();
    });
    function initPageEvFun(){
        //点击tab标签
        $(".user-right-top li").click(function(){
            var id=$(this).attr("id");
            if(id==tabId){
                return ;
            }
            tabId=id;
            initListPage1();
            $("li").removeClass("select-active");
            $(this).addClass("select-active");
        })

        $(".change-info-show").hide();
        $(".change-info-btn").click(function(){
            $(".change-info-top").hide();
            $(".change-info-show").show();
        })
        $(".write-box-input").change(function(){
            var inputle = $(this).val().length;
            $(".write-box-span i").text(inputle);
        })
        $(".write-box-textarea").change(function(){
            var textareale = $(this).val().length;
            $(".write-box-right i").text(textareale);
        })
        $(".write-box-input").focus(function(){
            $(this).parent().css("border-color","rgba(41,167,230,1)");
        })
        $(".write-box-input").blur(function(){
            $(this).parent().css("border-color","#ddd");
        })
        $(".write-box-textarea").focus(function(){
            $(this).parent().css("border-color","rgba(41,167,230,1)");
        })
        $(".write-box-textarea").blur(function(){
            $(this).parent().css("border-color","#ddd");
        })


        $(".sure-btn").click(function(){
            var inputval = $(".write-box-input").val();
            var textareaval =$(".write-box-textarea").val();
            if(inputval == "" || textareaval == ""){
                alert("请输入信息");
                return false;
            }
            $(".h3-name").text(inputval);
            $(".p-style").text(textareaval);

            $(".change-info-show").hide();
            $(".change-info-top").show();
        })
        $(".close-btn").click(function(){
            $(".change-info-show").hide();
            $(".change-info-top").show();
        })
    }

</script>



</body></html>